import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderStatisticsVO, OrderStatisticsForm, OrderStatisticsQuery } from '@/api/device/orderStatistics/types';

/**
 * 查询订单统计列表
 * @param query
 * @returns {*}
 */

export const listOrderStatistics = (query?: OrderStatisticsQuery): AxiosPromise<OrderStatisticsVO[]> => {
  return request({
    url: '/device/orderStatistics/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单统计详细
 * @param id
 */
export const getOrderStatistics = (id: string | number): AxiosPromise<OrderStatisticsVO> => {
  return request({
    url: '/device/orderStatistics/' + id,
    method: 'get'
  });
};

/**
 * 新增订单统计
 * @param data
 */
export const addOrderStatistics = (data: OrderStatisticsForm) => {
  return request({
    url: '/device/orderStatistics',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单统计
 * @param data
 */
export const updateOrderStatistics = (data: OrderStatisticsForm) => {
  return request({
    url: '/device/orderStatistics',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单统计
 * @param id
 */
export const delOrderStatistics = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/orderStatistics/' + id,
    method: 'delete'
  });
};
